home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13873 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  33 lines

  1. Newsgroups: comp.lang.c
  2. Path: owl3.office-workstations-ltd.co.uk!not-for-mail
  3. From: kenn@office-workstations-ltd.co.uk (Ken Nicolson)
  4. Subject: Re: HELP : Assignment with strings and pointers.
  5. Message-ID: <316bb0ec.1309731@newshost>
  6. Date: Wed, 10 Apr 1996 13:09:49 GMT
  7. References: <316ac5b5.4283622@news.planet.net> <4keairINN3jv@mayne.ugrad.cs.ubc.ca> <316B9FFA.ABD@wight.hursley.ibm.com>
  8. Organization: Office Workstations Limited
  9. Reply-To: kenn@owl-uk.co.uk
  10. X-Newsreader: Forte Agent .99d/32.182
  11.  
  12. Max Waterman <dwater@wight.hursley.ibm.com> wrote:
  13.  
  14. >Not alot of difference, though. But I'll bet I get flamed for this - I haven't checked it
  15. You *will* get flamed if you post wrong code offered as a solution, but at
  16. least you admit not to checking it. It is obvious that given the lines:
  17.  
  18. >  Size_T length_of_s2 = strlen( s2 );
  19. ...
  20. >    Int s2_index = length_of_s2 - s1_index;
  21. >    strings_are_same_backwards = ( s1[s1_index] == s2[s2_index] );
  22. when s1_index == 0 first time in, the expression "s2[s2_index]" is
  23. effectively s2[strlen( s2 )], the terminating '\0', not the last character
  24. in the string, so this routine will only work when s1 and s2 are empty
  25. strings.
  26.  
  27. >- and people usually get flamed in this group, no matter what they say. It's quite
  28. No, people usually get flamed when they post incorrect information. A wrong
  29. answer is worse than no answer at all.
  30.  
  31. Ken
  32.  
  33.